import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class ArchitectTurtle here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class ArchitectTurtle extends SkilledTurtle
{
    /**
     * Act - do whatever the ArchitectTurtle wants to do. This method is called whenever
     * the 'Act' or 'Run' button gets pressed in the environment.
     */
    public void act() 
    {
        jumpRandomly();
        drawHouse(50);
    }    
    private void drawDoor(int edgeSize){
        penUp();
        move(edgeSize / 5);
        penDown();
        rectangle(edgeSize / 3, (- edgeSize * 2) / 3);
        penUp();
        move(-edgeSize / 5);
        penDown();
    }
    private void drawWindow(int edgeSize){
        penUp();
        turn(-90);
        move((edgeSize * 2) / 3);
        turn(90);
        move((9*edgeSize) / 15);
        penDown();
        square((edgeSize) / 3);
        penUp();
        move((-9*edgeSize) / 15);
        turn(-90);
        move((-edgeSize * 2) / 3);
        turn(90);
        penDown();
        
    }
    private void drawRoof(int edgeSize, int xOffset){
        penUp();
        turn(-90);
        move(edgeSize);
        turn(90);
        move(xOffset);
        penDown();
        rectangle(edgeSize + (2*edgeSize) / 9 , -edgeSize/5);
        penUp();
        move(-xOffset);
        turn(90);
        move(edgeSize);
        turn(-90);
        penDown();
    }
    private void drawMainHouse(int edgeSize){
        turn(-90);
        square(edgeSize);
        turn(90);
    }
    private void drawPort(int edgeSize){
        penUp();
        move(edgeSize);
        penDown();
        turn(-90);
        square((edgeSize * 5) / 6);
        turn(90);
        drawRoof((edgeSize * 5) / 6, 0);
        move(edgeSize / 6);
        rectangle((edgeSize) / 2, (- edgeSize * 2) / 3);
        penUp();
        move(-edgeSize / 6);
        move(-edgeSize);
        penDown();
    }
    private void drawChimney(int edgeSize){
        penUp();
        turn(-90);
        move(edgeSize + edgeSize/5);
        turn(90);
        move((edgeSize * 6) / 7);
        penDown();
        square(-(edgeSize * 2) / 7);
        penUp();
        move(-(edgeSize * 6) / 7);
        turn(-90);
        move(-edgeSize - edgeSize/5);
        turn(90);
        penDown();
    }
    public void drawHouse(int edgeSize){
        drawMainHouse(edgeSize);
        drawChimney(edgeSize);
        drawDoor(edgeSize);
        drawWindow(edgeSize);
        drawRoof(edgeSize, -edgeSize/9);
        drawPort(edgeSize);
    }
}
